Top Gear Windows Frontend Architecture
Release 1.2.0

Frontend base
This frontend is the completed Jungle Strike-derived Windows frontend used by
Civilization, adapted only for Top Gear's identity, exact ROM contract, static
core API and player-one input map. The former Top Gear launcher, Music Box,
WAV recorder, SDL video backend and separate diagnostic module are not part of
the production build.

Rendering
The static core owns a deterministic 256x224 BGRA framebuffer. Native Win32
presents completed frames in windowed or full-screen mode with optional integer
scaling. F8 captures the game framebuffer in windowed mode and the displayed
screen in full-screen mode. SDL is used for gamepad input, not video output.

Audio
The Full Static S-SMP/S-DSP core produces native 32,040 Hz stereo PCM. The
Jungle Strike/Mesen-derived DirectSound frontend queues that stream and
resamples only when required by the selected output device. Extra latency is
optional from 0 to 40 ms and is disabled at zero by default. Output rate,
resampler mode, safety prebuffer, ring size, drift correction, recovery and
resume fade remain configurable. These settings affect speaker presentation,
not static-core state.

Input
Keyboard and SDL gamepad bindings are configurable for player one. Persistent
key state is sampled for each emulated frame, while short presses are latched
until one complete frame consumes them. Gameplay keys are accepted while the
active launcher or one of its child controls owns focus; dialogs pause the game
before accepting text or navigation, so their keys cannot leak into the core.
Input state clears on pause, focus loss, ROM replacement and core failure.

Timing and diagnostics
The high-resolution waitable timer is the primary NTSC presentation clock.
Natural NTSC locking is enabled by default and advances one absolute deadline
per completed frame. Late host work rebases the deadline rather than producing
catch-up bursts and audio backlog. The optional title-bar FPS counter is
disabled by default. Static-core failures create a detailed text report and
fail closed instead of invoking an emulator fallback.

Persistence and portability
Five persistent full-machine snapshot slots are available. Top Gear has no
battery-backed SRAM, so no battery save is created. Release builds statically
link SDL and the Visual C++ runtime; Windows supplies Win32 and DirectSound.

Verification
CTest covers the public and diagnostics APIs, generated dispatch, renderer
instances, input/frontend settings, audio FIFO/output/resampling, snapshots,
static-audio ownership and purity, integrity manifests, exact-ROM smoke tests,
deterministic PCM continuation, and scripted 60-, 120- and 180-second routes.
